<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 检测数组里面的所有元素是否都大于10，如果满足则返回true， 如果不满足则返回 false
        let newArry = []
        function every(ele = 0, arr = []) {
            console.log(arr)
            for (let i = 0; i < arr.length; i++) {
                // 判断是否有元素小于等于10，有就push到新数组中
                if (arr[i] <= 10) {
                    newArry.push(arr[i])
                }
            }
            // 判断数组长度，如果数组没有长度就说明没有一个元素大于10  返回true
            return newArry.length === 0 ? true : false

        }
        console.log(every(10, [11, 20, 30]))   // true
        console.log(every(10, [10, 3, 30]))   // false



        function every1(ele = 0, arr = []) {
            for (let i = 0; i < arr.length; i++) {
                if (ele > arr[i])
                    return false
            }
            return true

        }
        console.log(every1(10, [11, 20, 30]))   // true
        console.log(every1(10, [10, 3, 30]))   // false





    </script>

</body>

</html>